package com.qf.config;/*
 *保护你的大熊
 *2021/12/18
 *15:42
 */

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMqConfig {

    @Bean
    public DirectExchange getExchange(){
        return new DirectExchange("boot-exchange", true, false);
    }


    @Bean
    public Binding getBinding1(@Qualifier("queue1") Queue queue , DirectExchange exchange){
        return BindingBuilder.bind(queue).to(exchange).with("dog");
    }

    @Bean
    public Binding getBinding2(@Qualifier("queue2") Queue queue , DirectExchange exchange){
        return BindingBuilder.bind(queue).to(exchange).with("pig");
    }


    @Bean("queue1")
    public Queue getQueue1(){
        return new Queue("boot-queue1");
    }

    @Bean("queue2")
    public Queue getQueue2(){
        return new Queue("boot-queue2");
    }

}
